package ro.gateway.aida.obj;

/**
 * <p>Title: Romanian AIDA</p>
 * <p>Description: :D application</p>
 * <p>Copyright: Copyright (comparator) 2003</p>
 * <p>Company: Romania Development Gateway </p>
 *
 * @author Mihai Popoaei, mihai_popoaei@yahoo.com, smike@intellisource.ro
 * @version 1.0-* @version $Id: AIDAObjSector.java,v 1.1 2004/10/24 23:37:10 mihaipostelnicu Exp $
 */
public class AIDAObjSector extends AIDAActivityObject {
	private AIDASector sector;
	private AIDASector subsector;
	private AIDASector subsector1;
	private String view_lang = null;

	public String getView_lang() {
		return view_lang;
	}

	public void setView_lang(String view_lang) {
		this.view_lang = view_lang;
		if (sector != null) {
			sector.setViewLang(view_lang);
		}
		if (subsector != null) {
			subsector.setViewLang(view_lang);
		}
		if (subsector1 != null) {
			subsector1.setViewLang(view_lang);
		}
	}

	public AIDAObjSector() {
		this.objectType = TYPE_SECTOR;
	}

	public AIDASector getSector() {
		return sector;
	}

	public void setSector(AIDASector sector) {
		this.sector = sector;
	}

	public boolean equals(AIDAObjSector sector) {
		if (sector.subsector1 == null ^ this.subsector1 == null) return false;
		if (sector.subsector == null ^ this.subsector == null) return false;
		if (sector.sector == null ^ this.sector == null) return false;

		if (sector.subsector1 != null) {
			return (sector.subsector1.getRo_aida_code() ==
				  this.subsector1.getRo_aida_code());
		}
		if (sector.subsector != null) {
			return (sector.subsector.getRo_aida_code() ==
				  this.subsector.getRo_aida_code());
		}
		if (sector.sector != null) {
			return (sector.sector.getRo_aida_code() ==
				  this.sector.getRo_aida_code());
		}

		return true;
//            if ( ( sector.sector.getCrs_code() == null ) ^
//                  ( this.sector.getCrs_code() == null ) )
//                  return false;
//            if ( ( sector.sector.getDac5_code() == null ) ^
//                  ( this.sector.getDac5_code() == null ) )
//                  return false;
//            if ( sector.sector.getDac5_code() != null )
//            {
//                  if ( !sector.sector.getDac5_code().equals( this.sector.getDac5_code() ) )
//                        return false;
//            }
//            if ( sector.sector.getCrs_code() != null )
//            {
//                  if ( !sector.sector.getCrs_code().equals( this.sector.getCrs_code() ) )
//                        return false;
//            }
//
//            if ( ( sector.subsector == null ) ^ ( this.subsector == null ) )
//                  return false;
//            if ( sector.subsector != null )
//            {
//                  if ( ( sector.subsector.getCrs_code() == null ) ^
//                        ( this.subsector.getCrs_code() == null ) )
//                        return false;
//                  if ( ( sector.subsector.getDac5_code() == null ) ^
//                        ( this.subsector.getDac5_code() == null ) )
//                        return false;
//                  if ( sector.subsector.getDac5_code() != null )
//                  {
//                        if ( !sector.subsector.getDac5_code().equals( this.subsector.getDac5_code() ) )
//                              return false;
//                  }
//                  if ( sector.subsector.getCrs_code() != null )
//                  {
//                        if ( !sector.subsector.getCrs_code().equals( this.subsector.getCrs_code() ) )
//                              return false;
//                  }
//            }
//
//            return true;
	}

	public void setSubsector(AIDASector subsector) {
		this.subsector = subsector;
	}

	public AIDASector getSubsector() {
		return subsector;
	}

	public void setSubsector1(AIDASector subsector1) {
		this.subsector1 = subsector1;
	}

	public AIDASector getSubsector1() {
		return subsector1;
	}
}